// 该hook用于点击触发古诗
let poems = ["远上寒山石径斜","白云深处有人家","停车坐爱枫林晚","霜叶红于二月花","京口瓜洲一水间","钟山只隔数重山","春风又绿江南岸","明月何时照我还","碧玉妆成一树高","万条垂下绿丝绦","不知细叶谁裁出","二月春风似剪刀","月落乌啼霜满天","江枫渔火对愁眠","姑苏城外寒山寺","夜半钟声到客船"]
export default ()=>{
    document.addEventListener('click',e=>{
        let div = document.createElement('div');
        let keyframes = `@keyframes pointPoem{
            from {
                margin-top:0px;
                opactiy:1;
                
            }
            to {
                margin-top:-150px;
                opactiy:0.1;
            }
        }`
        let style = document.createElement('style');
        style.innerHTML = keyframes;
        document.body.appendChild(style);
        div.style.position = 'fixed'
        div.style.top = e.pageY + 'px';
        div.style.left = e.pageX + 'px';
        div.style.userSelect = 'none';
        div.innerHTML = poems[Math.floor(Math.random()*poems.length)];
        div.style.animation = "2s linear pointPoem"
        div.style.color = `rgb(${Math.floor(Math.random()*255)},${Math.floor(Math.random()*255)},${Math.floor(Math.random()*255)})`;
        document.body.appendChild(div);
        setTimeout(()=>{
            document.body.removeChild(div);
        },2000)
    })

}